package accel.dataholders;

import accel.activities.R;
import accel.movement.AttackSet;

public class Character {

	private Weapon weapon = null;
	private int dbId = -1;
	
	private int name;
	private int portrait;
	private Stats stats;
	private int level = 1;
	private int exp = 0;
	private int descId;
	private AttackSet attacks;
	
	public int DBID()
	{
		return dbId;
	}
	
	public void setDBID(int id)
	{
		dbId = id;
	}
	
	public void setWeapon (Weapon weapon)
	{
		this.weapon = weapon;
	}
	
	public Weapon getWeapon ()
	{
		return weapon;
	}
	
	public static Character instance = null;
	
	public Character(int name,Stats stats, int portrait, int descId)
	{
		this(name, stats, portrait, descId, -1);
	}
	
	public Character(int name,Stats stats, int portrait, int descId, AttackSet set)
	{
		this(name, stats, portrait, descId, -1);
		this.attacks = set;
	}
	
	public Character(int name, int portrait, int descId, int level, int exp, Stats stats)
	{
		this(name, portrait, descId, level, exp, stats, -1);
	}
	
	public Character(int name,Stats stats, int portrait, int descId, int dbId)
	{
		this.name = name;
		this.stats = stats;
		this.portrait = portrait;
		this.descId = descId;
		this.dbId = dbId;
	}
	
	public Character(int name, int portrait, int descId, int level, int exp, Stats stats, int dbId)
	{
		this.name = name;
		this.portrait = portrait;
		this.level = level;
		this.exp = exp;
		this.stats = stats;
		this.descId = descId;
		this.dbId = dbId;
	}
	
	public static Character [] getCharacters()
	{
		Character c1 = new Character(R.string.soul_name1,new Stats(1,2,3,4,5,1),R.drawable.port1,R.string.desc_1);
		c1.setAttacks(AttackSet.attackCollection[0].generateForParent(c1));
		Character c2 = new Character(R.string.soul_name2,new Stats(6,7,8,9,10,1), R.drawable.port2, R.string.desc_2);
		c2.setAttacks(AttackSet.attackCollection[0].generateForParent(c2));
		Character s[] = {c1,c2};
		return s;
	}
	
	public static Integer [] getDrawablesArray()
	{
		Integer[] pics = {
	            R.drawable.port1,
	            R.drawable.port2
	    };
		return pics;
	}
	
	public void setLevel (int level)
	{
		this.level = level;
	}
	public void levelUp()
	{
		this.level++;
	}
	public int getLevel()
	{
		return level;
	}
	public Stats getStats()
	{
		return stats;
	}
	public int getPortrait()
	{
		return portrait;
	}
	public int getName()
	{
		return name;
	}
	public void addExp(int exp)
	{
		this.exp += exp;
	}
	public int getExp()
	{
		return exp;
	}
	public int expForNextLevel()
	{
		return 1000;
	}
	public int getDesciption()
	{
		return descId;
	}
	public int strength()
	{
		return stats.strength() + (weapon == null? 0 : weapon.getStats().strength());
	}
	public int energy()
	{
		return stats.energy() + (weapon == null? 0 : weapon.getStats().energy());
	}
	public int health()
	{
		return stats.health() + (weapon == null? 0 : weapon.getStats().health());
	}
	public int charisma()
	{
		return stats.charisma() + (weapon == null? 0 : weapon.getStats().charisma());
	}
	public int speed()
	{
		return stats.speed() + (weapon == null? 0: weapon.getStats().speed());
	}
	public int learningSpeed()
	{
		return stats.learningSpeed() + (weapon == null? 0 : weapon.getStats().learningSpeed());
	}
	public void setAttacks(AttackSet attacks)
	{
		this.attacks = attacks;
	}
	public AttackSet getAttacks()
	{
		return attacks;
	}
}
